package com.emuporium.gymrat.server.data;

import java.sql.Date;
import java.sql.Timestamp;
import java.util.ArrayList;

import org.simpleframework.xml.Attribute;
import org.simpleframework.xml.Element;
import org.simpleframework.xml.ElementList;
import org.simpleframework.xml.Root;

@Root(name = "routine")
public class Routine {

	private Timestamp timestamp;
	@Attribute
	private int id; // local db id for this
	@Element
	private String name;
	@Element
	private String description;
	@Element
	private String author;
	@Element
	private int creatorId;
	@Element
	private int sourceId;
	@Element
	private int primary;
	@Element
	private int secondary;
	private int users;
	private int votesUp;
	private int votesDown;
	private int myVote;
	private int programId;
	private Date lastLoggedDate;
	private ArrayList<LogEntry> logs;
	private String programNote;
	@Element
	private boolean shared;
	@Element(required = false)
	private String website;
	@ElementList
	private ArrayList<Entry> entries;

	public Routine() {
		entries = new ArrayList<Entry>();
		logs = new ArrayList<LogEntry>();

	}

	public Routine(int id, String _name, String _description, String _author) {
		this.id = id;
		name = _name;
		description = _description;
		author = _author;
		entries = new ArrayList<Entry>();
	}

	public void setId(int id) {
		this.id = id;
	}

	public void setName(String _name) {
		name = _name;
	}

	public void setDescription(String _description) {
		description = _description;
	}

	public void setAuthor(String _author) {
		author = _author;
	}

	public int getId() {
		return id;
	}

	public String getName() {
		return name;
	}

	public String getDescription() {
		return description;
	}

	public String getAuthor() {
		return author;
	}

	@Override
	public String toString() {
		return new String(name);
	}

	public ArrayList<Entry> getEntries() {
		return entries;
	}

	public void setEntries(ArrayList<Entry> entries) {
		this.entries = entries;
	}

	public void addEntry(Entry entry) {
		entries.add(entry);
	}

	public String getWebsite() {
		return website;
	}

	public void setWebsite(String website) {
		this.website = website;
	}

	public Timestamp getTimestamp() {
		return timestamp;
	}

	public void setTimestamp(Timestamp timestamp) {
		this.timestamp = timestamp;
	}

	public int getPrimary() {
		return primary;
	}

	public void setPrimary(int primary) {
		this.primary = primary;
	}

	public int getSecondary() {
		return secondary;
	}

	public void setSecondary(int secondary) {
		this.secondary = secondary;
	}

	public boolean isShared() {
		return shared;
	}

	public void setShared(boolean shared) {
		this.shared = shared;
	}

	public int getCreatorId() {
		return creatorId;
	}

	public void setCreatorId(int creatorId) {
		this.creatorId = creatorId;
	}

	public int getSourceId() {
		return sourceId;
	}

	public void setSourceId(int sourceId) {
		this.sourceId = sourceId;
	}

	public int getUsers() {
		return users;
	}

	public void setUsers(int users) {
		this.users = users;
	}

	public int getVotesUp() {
		return votesUp;
	}

	public void setVotesUp(int votesUp) {
		this.votesUp = votesUp;
	}

	public int getVotesDown() {
		return votesDown;
	}

	public void setVotesDown(int votesDown) {
		this.votesDown = votesDown;
	}

	public int getMyVote() {
		return myVote;
	}

	public void setMyVote(int myVote) {
		this.myVote = myVote;
	}

	public int getProgramId() {
		return programId;
	}

	public void setProgramId(int programId) {
		this.programId = programId;
	}

	public String getProgramNote() {
		return programNote;
	}

	public void setProgramNote(String programNote) {
		this.programNote = programNote;
	}

	public Date getLastLoggedDate() {
		return lastLoggedDate;
	}

	public void setLastLoggedDate(Date lastLoggedDate) {
		this.lastLoggedDate = lastLoggedDate;
	}

	public ArrayList<LogEntry> getLogs() {
		return logs;
	}

	public void setLogs(ArrayList<LogEntry> logs) {
		this.logs = logs;
	}
}